<%@ include file="connect.jsp" %>
<%--
  Created by IntelliJ IDEA.
  User: Mery
  Date: 10/25/12
  Time: 11:03 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<html>
<head>
    <title>Business English</title>
    <link href="style.css" rel="stylesheet"/>
    <script type="text/javascript" language="javascript">
        function confirmAction() {
            var confirmed = confirm("Are you sure want to delete this question?");
            return confirmed;
        }
    </script>
    <script src="jquery.js" type="text/javascript"></script>
    <script src="facebox.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery(document).ready(function ($) {
            $('a[rel*=facebox]').facebox({
                loadingImage:'images/loading.gif',
                closeImage:'images/closelabel.png'
            })
        })
    </script>
</head>
<body>
<table id="bg" cellspacing="0">
    <tr id="header">

        <td class="link">
            <%@ include file="header.jsp" %>
        </td>
    </tr>
    <tr id="menu">
        <td>
            <%@ include file="menu.jsp" %>
        </td>
    </tr>
    <tr id="hr">
        <td><hr width="100%" size="8" noshade="noshade" ></td>
    </tr>
    <tr id="content">
        <td class="link" valign="top" style="padding-left: 20px">

            <table>
                <tr id="title">
                    <td>Games >> Edit Question</td>
                </tr>
                <% String id = request.getParameter("id");

                %>

                <form action="AddNewQueGames.jsp">
                    <table>
                        <tr>
                            <td>
                                <div id="btn-fld">
                                    <button type="submit">Add New Question</button>
                                </div>
                            </td>
                            <input type="hidden" name="gamesID" id="gamesID" value="<%out.print(id);%>">
                        </tr>
                    </table>
                </form>
                <table>
                    <tr id="warning">
                        <td>

                            <%
                                String respon = request.getParameter("respon");

                                if (respon != null) {

                                    out.print(respon + " "); //ga tau nih gmn ya mau masukkin namanya, apa delete berdasarkan nama ??
                            %>   <%=session.getAttribute("id")%>
                            <% } %>
                        </td>
                    </tr>
                </table>
                <table width="850px" border="2" id="bor1">

                    <tr style="text-align: center; font-weight: 600">
                        <td>No</td>
                        <td>Question's Type</td>
                        <td>Question</td>
                        <td width="125px">Action</td>
                    </tr>

                    <tr>
                        <%

                            int i = 0;
                            ResultSet rs = stat.executeQuery
                                    ("select * from DetailGames a, Styles b where a.stylesID = b.stylesID and gamesID = '" + id + "' order by stylesid asc");
                            while (rs.next()) {
                                i = i + 1;

                        %>
                        <td align="center"><%=i%>
                        </td>
                        <td><%out.print(rs.getString("stylesName"));%></td>
                        <td><%out.print(rs.getString("question"));%></td>
                        <td style="text-align: center"><a
                                href="EditQueGames.jsp?id=<%out.print(rs.getString("detailGamesID"));%>"
                                rel="facebox"><img height="25px" src="edit.png" title="Edit Question"></a>&nbsp;&nbsp;
                            <a href="doDeleteQueGames.jsp?id=<%out.print(rs.getString("detailGamesID"));%>"
                               onclick="return confirmAction()"><img height="25px" src="Delete.png"
                                                                     title="Delete Question"></a></td>
                    </tr>

                    <% } %>

                </table>


            </table>
        </td>
    </tr>

</table>
</body>
</html>